jQuery(document).ready(function($){$('body').on('click','.rem-compare-btn',function(e){event.preventDefault();if(!$(this).hasClass('active')){$(this).addClass('active');$(this).find('i').removeClass('fa-plus').addClass('fa-check')}else{return};var p_id=$(this).data('property_id');var the_box=$(this).closest('.rem-property-box');var html=get_compare_box_html(p_id,the_box);$(".property-box").append(html);if($(".prop-compare-wrapper .items_compare").length>1){$(".prop-compare-wrapper").animate({right:"0"},500);$('.compare_close').show()}});$('body').on('click','.compare_open',function(){$(".prop-compare-wrapper").animate({right:"0"},500);$('.compare_open').hide();$('.compare_close').show()});$('body').on('click','.compare_close',function(){$(".prop-compare-wrapper").animate({right:"-301"},500);$('.compare_open').show();$('.compare_close').hide()});function get_compare_box_html(p_id,the_box){var imgurl=the_box.find('.rem-f-image').attr('src');var title=the_box.find('.property-title').text();var price=the_box.find('.property-price').html();var html='';html+='';html+=''+title+''+price+'';html+='';html+='';return html} $('body').on('click','.remove-from-compare-btn',function(event){event.preventDefault();var id=$(this).closest('.items_compare').data('property_id');$('a[data-property_id="'+id+'"]').removeClass('active');$('a[data-property_id="'+id+'"] i').removeClass('fa-check').addClass('fa-plus');$(this).closest('.items_compare').remove();if($(".prop-compare-wrapper .items_compare").length<=1){$(".prop-compare-wrapper").animate({right:"-301"},500);$('.compare_open').hide();$('.compare_close').hide()}});$("#rem-compare-modal").iziModal({zindex:999,padding:10,width:'80%',fullscreen:!0,overlayColor:"rgba(0,0,0,0.6)",transitionOut:"bounceInUp",transitionOut:"fadeOutDown",onOpening:function(modal){var property_ids=[];$('.items_compare').each(function(index,val){property_ids.push($(this).data('property_id'))});var data={'action':'rem_compare_properties','property_ids':property_ids} modal.startLoading();$.post(rem_compare.ajaxurl,data,function(resp){$("#rem-compare-modal .iziModal-content tbody").html(resp);modal.stopLoading()})}})}) ;